<template>
  <div class="rail-service">
    <div class="service-container">
      <div class="service-header">
        <div class="tit-line">
          <span class="tit-line1"></span>
          <span class="tit-line2"></span>
        </div>
        <h2 class="solve-tit">{{$t('contentDetails.advantageTitle')}}</h2>
      </div>

      <div class="service-features">
        <el-row :gutter="20">
          <el-col
            v-for="(item, index) in advantageData"
            :key="index"
            :xs="24"
            :sm="24"
            :md="12"
            :lg="8"
          >
            <el-card class="service-card" :body-style="{ padding: '0px' }">
              <img
                :src="baseUrl+item.itemIcon"
                class="image"
                :alt="item.title"
                loading="lazy"
              />
              <div class="card-content">
                <span class="client-desc">{{item.title}}</span>
                <div class="card-body">
                  <p>{{item.content}}</p>
                </div>
              </div>
            </el-card>
          </el-col>
        </el-row>
      </div>
    </div>
  </div>
</template>
<script >
export default {
  props: {
    advantageData: {
      type: Array,
      default: () => []
    }
  },
  computed: {
    baseUrl() {
      return process.env.VUE_APP_BASE_API
    }
  },
  methods: {

  }
}
</script>

<style scoped lang="scss">
/* 基础样式 */
.rail-service .service-card{
  height: 420px;
  margin-bottom: 30px;
  transition: all 0.3s ease;
  &:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(254, 50, 49, 0.2) !important;
    border: 1px solid rgba(254, 50, 49, 1);
  }
}

.client-desc{
  font-weight: 550;
  font-size: 18px;
  margin-bottom: 10px;
  display: block;
}

.service-container {
  max-width: 1200px;
  margin: 0 auto 0;
  padding: 0 20px;
}

.service-header {
  text-align: left;
}

.service-features{
  padding: 30px 0;
}

.rail-service{
  margin-bottom: 50px;
}

.tit-line {
  display: flex;
  justify-content: left;
  margin-bottom: 20px;
}

.tit-line1, .tit-line2 {
  height: 8px;
  background: #fe3231;
  border-radius: 10px;
}

.tit-line1 {
  width: 60px;
}

.tit-line2 {
  width: 10px;
  margin-left: 10px;
}

.solve-tit {
  font-size: 30px;
  font-weight: bold;
  color: #333;
  margin-bottom: 15px;
  text-align: left;
}

.card-content {
  padding: 14px;
}

.image {
  width: 100%;
  display: block;
}

/* ========== 移动端适配 ========== */
@media (max-width: 992px) {
  .service-container {
    padding: 0 15px;
  }

  .service-features {
    padding: 20px 0;
  }

  .rail-service .service-card {
    height: 380px;
    margin-bottom: 20px;
  }

  .solve-tit {
    font-size: 26px;
  }

  .client-desc {
    font-size: 17px;
  }
}

@media (max-width: 768px) {
  .service-header {
    text-align: center;
  }

  .tit-line {
    justify-content: center;
    margin-bottom: 15px;
  }

  .solve-tit {
    font-size: 24px;
    text-align: center;
  }

  .service-features {
    padding: 15px 0;
  }

  .rail-service .service-card {
    height: auto; /* 高度自适应内容 */
    min-height: 350px; /* 最低高度保证一致 */
    margin-bottom: 20px;

    /* 悬停效果在移动端优化 */
    &:hover {
      transform: translateY(-3px);
      box-shadow: 0 5px 15px rgba(254, 50, 49, 0.15) !important;
    }
  }

  .el-row {
    margin-left: -10px !important;
    margin-right: -10px !important;
  }

  .el-col {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .image {
    max-height: 180px; /* 限制图片高度 */
    object-fit: cover;
  }

  .card-content {
    padding: 12px;
  }

  .client-desc {
    font-size: 16px;
    text-align: center;
  }

  .card-body p {
    font-size: 14px;
    text-align: center;
    line-height: 1.6;
  }
}

@media (max-width: 480px) {
  .solve-tit {
    font-size: 22px;
  }

  .tit-line1 {
    width: 50px;
  }

  .tit-line2 {
    width: 8px;
    margin-left: 8px;
  }

  .rail-service .service-card {
    min-height: 320px;
    margin-bottom: 15px;
  }

  .client-desc {
    font-size: 15px;
  }

  .card-body p {
    font-size: 13px;
  }

  .service-features {
    padding: 10px 0;
  }
}
</style>
